package com.ydd.adapter;

import android.support.v4.app.Fragment;
import android.support.v4.app.FragmentManager;
import android.support.v4.app.FragmentStatePagerAdapter;

import com.ydd.R;
import com.ydd.moudle.guide.GuideFragment;

import static com.ydd.moudle.guide.GuideActivity.PAGE_NUMS;

/**
 * Created by tao on 17-3-19.
 */

public class GuideViewPagerAdapter extends FragmentStatePagerAdapter {

    public GuideViewPagerAdapter(FragmentManager fm) {
        super(fm);
    }

    @Override
    public Fragment getItem(int position) {
        GuideFragment fragment = null;
        switch (position) {
            case 0:
                fragment = GuideFragment.newInstance(R.layout.fragment_welcome_one);
                break;
            case 1:
                fragment = GuideFragment.newInstance(R.layout.fragment_welcome_two);
                break;
            case 2:
                fragment = GuideFragment.newInstance(R.layout.fragment_welcome_three);
                break;
            case 3:
                fragment = GuideFragment.newInstance(R.layout.fragment_welcome_four);
                break;
            case 4:
                fragment = GuideFragment.newInstance(R.layout.fragment_welcome_five);
                break;
        }
        return fragment;
    }

    @Override
    public int getCount() {
        return PAGE_NUMS;
    }
}
